<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'comet4j.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<!-- jQuery -->
	<script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
	<!-- comet4j插件 -->
    <script src="${pageContext.request.contextPath}/plugins/comet4j/comet4j-0.1.7-debug.js"></script>
	<script type="text/javascript">
function initTest() {
		// 引擎事件绑定
		JS.Engine.on({
			start : function(cId, channels, engine) {
				alert(engine.getConnector().workStyle);
				//TODO 开始时执行该方法
			},
			stop : function(cause, url, cId, engine) {
				//TODO 断开时执行该方法
			},
			notice : function(data, timespan, engine) {
				//TODO 通知公告提醒
				$("#test").html(data.title);
				//that.createPopPanel("message-push",data);
			},
			message : function(data, timespan, engine) {
				//TODO 通知公告提醒
				$("#test").html(data.title);
				//that.createPopPanel("message-push",data);
			}
		});
		JS.Engine.start('conn','cid=u123456789');
}
function send() {
	$.post('test/send.do',function(data){});
}
</script>
  </head>
  
  <body onload="initTest()">
    <div id="test">123</div>
    <div class="">
       <button onclick="send()">测试</button>
    </div>
  </body>
</html>
